-
Notifications
You must be signed in to change notification settings - Fork 1.1k
#3071: create new directory setting and use for '-d' parameter #3120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Have an awesome day! ☀️
@@ -158,6 +161,10 @@ object Settings { | |||
case Success(v) => update(v, args) | |||
case Failure(ex) => fail(ex.getMessage, args) | |||
} | |||
case (DirectoryTag, arg :: args) => | |||
val path = Path(arg) | |||
if (path.isDirectory) update(arg, args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, it should be update(path.toDirectory, args)
@@ -17,7 +18,7 @@ class ScalaSettings extends Settings.SettingGroup { | |||
val javaextdirs = PathSetting("-javaextdirs", "Override java extdirs classpath.", Defaults.javaExtDirs) | |||
val sourcepath = PathSetting("-sourcepath", "Specify location(s) of source files.", "") // Defaults.scalaSourcePath | |||
val classpath = PathSetting("-classpath", "Specify where to find user class files.", defaultClasspath) withAbbreviation "-cp" | |||
val d = StringSetting("-d", "directory|jar", "destination for generated classfiles.", ".") | |||
val d = DirectorySetting("-d", "directory|jar", "destination for generated classfiles.", Directory(Path("."))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably rename this setting to something like outputDir
also make sure that directory exists
I've had to touch up the tests so that the output directory actually exists. |
Could you add a test under class SettingTests {
...
@Test def missingOutputDir: Unit = {
val options = Array("-d", "not_here")
val reporter = Main.process(options)
assertEquals(reporter.errorCount, 1)
assertEquals(reporter.allErrors.head.message, "'not_here' does not exist or is not a directory")
}
} |
Sure thing! |
Nitpick: To automatically close the issue when a PR is merged, you should put "Fix #nnnn" in the commit message, just putting "#nnnn" is not enough. |
Thanks for the nitpicking! I've updated the last commit comment, I hope that suffices. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for your contribution!
also make sure that directory exists when updating setting